<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- creator-cppcheck.qdoc -->
  <title>Analyzing Code with Cppcheck | Qt Creator Manual</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt Creator Manual</a></td><td >Analyzing Code with Cppcheck</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="index.html">Qt Creator Manual 4.11.1</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="creator-cpu-usage-analyzer.html" />
  <link rel="next" href="creator-ctf-visualizer.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="creator-cpu-usage-analyzer.html">Analyzing CPU Usage</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-ctf-visualizer.html">Visualizing Chrome Trace Events</a>
</p><p/>
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Analyzing Code with Cppcheck</h1>
<span class="subtitle"></span>
<!-- $$$creator-cppcheck.html-description -->
<div class="descr"> <a name="details"></a>
<p><a href="http://cppcheck.sourceforge.net/">Cppcheck</a> is a static analysis tool that detects errors in C++ code. Static analysis is performed on the source code without actually executing the application.</p>
<p>The experimental Cppcheck Diagnostics plugin integrates diagnostics that are generated by the Cppcheck tool into the C++ editor.</p>
<p>To enable running Cppcheck automatically on currently open files:</p>
<ol class="1" type="1"><li>Select <b>Help</b> &gt; <b>About Plugins</b> &gt; <b>Code Analyzer</b> &gt; <b>Cppcheck</b> to enable the plugin.</li>
<li>Restart Qt Creator to load the plugin.</li>
<li>Select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Analyzer</b> &gt; <b>Cppcheck</b> to specify settings for running Cppcheck.<p class="centerAlign"><img src="images/qtcreator-cppcheck-options.png" alt="&quot;Cppcheck options&quot;" /></p></li>
<li>In the <b>Binary</b> field, enter the path to the Cppcheck executable file.</li>
<li>In the <b>Checks</b> group, select the checks to perform on currently open files.<p><b>Note: </b>By default, Cppcheck uses multiple threads to perform checks. Selecting the <b>Unused functions</b> option disables the default behavior.</p></li>
<li>In the <b>Custom arguments</b> field, enter additional arguments for running Cppcheck. The arguments might be shadowed by automatically generated ones. To avoid possible conflicts in configuration, select the <b>Show raw output</b> check box to see the final arguments.</li>
<li>In the <b>Ignored file patterns</b> field, enter a filter for ignoring files that match the pattern (wildcard). You can enter multiple patterns separated by commas. Even though Cppcheck is not run on files that match the provided patterns, they might be implicitly checked if other files include them.</li>
<li>Select the <b>Inconclusive errors</b> check box to also mark possible false positives.</li>
<li>Select the <b>Check all define combinations</b> check box to check all define combinations. Enabling this option can significantly slow down analysis, but might help to find more issues.</li>
<li>Select the <b>Add include paths</b> check box to pass the current project's include paths to Cppcheck. Enabling this option slows down checks on big projects, but can help Cppcheck to find missing includes.</li>
<li>Select the <b>Calculate additional arguments</b> check box to calculate additional arguments based on current project's settings (such as the language used and standard version) and pass them to Cppcheck.</li>
</ol>
<p>Qt Creator automatically runs Cppcheck on currently opened documents and displays results via text marks or annotations.</p>
</div>
<!-- @@@creator-cppcheck.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="creator-cpu-usage-analyzer.html">Analyzing CPU Usage</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-ctf-visualizer.html">Visualizing Chrome Trace Events</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
